import matplotlib
matplotlib.use('Agg')
import seaborn as sns
from matplotlib.font_manager import FontProperties
font_path = r'C:\Windows\Fonts\msyh.ttc'
myfont = FontProperties(fname=font_path)
sns.set(font=myfont.get_name())
from flask import Flask, render_template

from src.core import (
    init_stu_dash,
    init_bias_dash,
    init_subsidy_dash,
    init_prediction_app,
    init_academic_atmosphere,
    init_subject_recommendations,
)


def create_app():
    server = Flask(__name__, template_folder='assets')

    init_stu_dash(server)
    init_bias_dash(server)
    init_subject_recommendations(server)
    init_academic_atmosphere(server)
    init_subsidy_dash(server)
    init_prediction_app(server)
    
    return server

app = create_app()

@app.route('/')
def index():
    return render_template('index.html')

if __name__ == '__main__':
    app.run(host='127.0.0.1', port=8888)